package 哈希表;

public class Demo01 {
    static class Solution {
        public boolean canConstruct(String ransomNote, String magazine) {
            int[] arr = new int[26];
            for(int i = 0; i<magazine.length(); i++){
                char a = magazine.charAt(i);
                arr[a-97]++;
            }

            for(int i = 0; i<ransomNote.length(); i++){
                char c = ransomNote.charAt(i);
                if(arr[c-97] == 0){
                    return false;
                }
                arr[c-97]--;
            }
            return true;

        }
    }
}
